/**
 * 在一个二维矩阵上画矩形，或者画直线
 * 其中直线有四个方向：横平竖直、正反对角
 * 注意到矩形其实就是两个方向的直线，因此重点实现画直线即可。
 */
#include <bits/stdc++.h>
using namespace std;

using vi = vector<int>;

vector<string> Board;
int N, M;
int Q;

void drawRowLine(int x, int y1, int y2){
    auto & s = Board[x];
    for(int i=y1;i<=y2;++i){
        s[i] = 'x';
    }
    return;
}

void drawColLine(int y, int x1, int x2){
    for(int i=x1;i<=x2;++i){
        Board[i][y] = 'x';
    }
    return;
}


void drawRect(int top, int left, int bot, int right){
    drawRowLine(top, left, right);
    drawRowLine(bot, left, right);
    drawColLine(left, top, bot);
    drawColLine(right, top, bot);
}

void drawDiag(int top, int left, int bot, int right){
    for(int x=top,y=left;x<=bot;++x,++y){
        Board[x][y] = 'x';
    }
}

void drawAntiDiag(int top, int left, int bot, int right){
    for(int x=top,y=left;x<=bot;++x,--y){
        Board[x][y] = 'x';
    }
}

int main() {
#ifndef ONLINE_JUDGE
    freopen("z.txt", "r", stdin);
#endif
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    cin >> N >> M >> Q;
    Board.assign(N + 1, string(M + 1, '.'));
    for(int q=1;q<=Q;++q){
        int cmd, x1, y1, x2, y2;
        cin >> cmd >> x1 >> y1 >> x2 >> y2;
        if(1 == cmd){
            if(x1 == x2){
                drawRowLine(x1, min(y1, y2), max(y1, y2));
            }else if(y1 == y2){
                drawColLine(y1, min(x1, x2), max(x1, x2));
            }else if(y1 - y2 == x1 - x2){
                drawDiag(min(x1, x2), min(y1, y2), max(x1, x2), max(y1, y2));
            }else{
                drawAntiDiag(min(x1, x2), max(y1, y2), max(x1, x2), min(y1, y2));
            }
        }else if(2 == cmd){
            drawRect(min(x1, x2), min(y1, y2), max(x1, x2), max(y1, y2));
        }else{
            while(1);
        }
    }

    for(int i=1;i<=N;++i){
        cout << Board[i].substr(1) << "\n";
    }
    return 0;
}